package cn.csdj.sism.web;

import cn.csdj.sism.pojo.RolePermission;
import cn.csdj.sism.service.RolePermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
/**
 * Controller实现类
 * 李心怡
 * 2023/4/10
 */
@CrossOrigin
@RestController
@RequestMapping("/rolePermission")
public class RolePermissionController {
    @Autowired
    private RolePermissionService rolePermissionService;
    @PostMapping
    public void insert(@RequestBody RolePermission rolePermission){
        rolePermissionService.insert(rolePermission);
    }
    @DeleteMapping("/{id}")
    public void deleteById(@PathVariable Integer id){
        rolePermissionService.deleteById(id);
    }
    @PutMapping
    public void update(@RequestBody RolePermission rolePermission){
        rolePermissionService.update(rolePermission);
    }
    @GetMapping("/{id}")
    public RolePermission selectById(@PathVariable Integer id){
        return rolePermissionService.selectById(id);
    }
    @GetMapping
    public List<RolePermission> selectAll(){
        return rolePermissionService.selectAll();
    }
}
